from scheduler_package.utils.add_task_scheduler import get_add_job_scheduler
from datetime import datetime,timedelta
from apscheduler.triggers.date import DateTrigger

scheduler = get_add_job_scheduler()

def run_scheduler_task(func, task_id, task_name, data_dict=None):
    run_date = datetime.now()+timedelta(seconds=3)
    if data_dict:
        scheduler.add_job(func,trigger=DateTrigger(run_date=run_date), args=(data_dict,), id=task_id, name=task_name)
    else:
        scheduler.add_job(func,trigger=DateTrigger(run_date=run_date), id=task_id, name=task_name)
